import UniformScaleBase from "./UniformScaleBase";

const { ccclass, property, requireComponent, menu } = cc._decorator;

/**
 * 设置mask遮罩尺寸, 保证遮罩节点能在当前分辨率下铺满屏幕
 */
@ccclass
@requireComponent(cc.Sprite)
@menu('UniformScale/UniformScaleMask')
export default class UniformScaleMask extends UniformScaleBase {

    protected doUniformScale() {
        if (!this.active)
            return;
        let maskSize = cc.view.getFrameSize().clone();
        const scale = this.getViewScale(maskSize);
        maskSize.width *= scale.x * this.canvasScale;
        maskSize.height *= Math.max(scale.x, 1) * this.canvasScale;
        this.node.setContentSize(maskSize);
    }

}
